package com.qf.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

public class MainCallableTest {

	
	public static void main(String[] args) throws Exception{
		//1.创建Callable的线程任务队列
		CallableTest call = new CallableTest();
		
		
		//2.Callable无法直接当参数后传入Runnable，没有继承和实现关系
		FutureTask<Integer> futureTask = new FutureTask<Integer>(call);
		
		
		
		//3.
		Thread t = new Thread(futureTask);
		
		//4.
		t.start();
		
		//5.可能发生阻塞，相互又通信
		Integer res = futureTask.get();
		
		System.out.println("子线程结果："+res);
		
		System.out.println("主线程执行结束...");
		
	}
}
